package HibernateOrderManagerment.bean;

import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Table(name="store")
@Entity
public class Store {
	@Id
	@Column(name="id")
	private long id;
	@Column(name="name")
	private String name ;
//	@Column(name="user_id")
//	private long userId;
	@OneToMany
	@JoinColumn(name="store_id")
	private Set<StoreGoods> storeGoods;
	@ManyToOne
	@JoinColumn(name="user_id")
	private User users;
	
	public Store(){
		id=-1;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Set<StoreGoods> getStoreGoods() {
		return storeGoods;
	}

	public void setStoreGoods(Set<StoreGoods> storeGoods) {
		this.storeGoods = storeGoods;
	}

	public User getUsers() {
		return users;
	}

	public void setUsers(User users) {
		this.users = users;
	}

	@Override
	public String toString() {
		return "Store [id=" + id + ", name=" + name + ", usersId=" + users.getId() + "]";
	}


	

}
